// 拼接HTTPUrl
function getUrl(type, pathname) {
  return window.RPConfig[type] + pathname
}

const mgtApi = {
  // 获取组织
  getAuthorizedOrgs: orgPath => {
    return $http
      .get(getUrl('itShare', '/org/tree'), { orgPath, orgTypeFilter: 1, enabled: 1 })
      .then(res => res.data.data)
  },
  // 获取组织
  getRefresh: orgPath => {
    return $http
      .get(getUrl('itShare', '/org/tree/refresh'), { orgPath, orgTypeFilter: 1, enabled: 1 })
      .then(res => res.data.data)
  },
  // 获取当前用户信息
  getLoginData: params => {
    return $http.post(getUrl('mgt', '/security/getLoginData'), params).then(res => res.data)
  },
  // 获取用户列表
  getUserListPageNoTotal: params => {
    return $http.post(getUrl('user', '/getUserListPageNoTotal'), params)
  },
  // 获取用户列表
  getUser: params => {
    return $http.post(getUrl('userCenter', '/public/user/org/list/page'), params)
  },
  // 获取覆盖度目标所有数据
  getGoalData: params => {
    return $http.post(getUrl('itShare', '/dc/target/page'), params).then(res => res.data)
  }
}

export default mgtApi
